const obj = { a: 1, b: 2, c: 3, d: 4 };
// 输以下这种形式
// [{text:1,value:"a"}]
const res = Object.entries(obj).map(v => {
    return { text: v[1], value: v[0] }
});

console.log(res);

const obj1 = res.reduce((acc, v) => {
    acc[v.value] = v.text;
    return acc;
}, {});
console.log(obj1);